package 笔试;

import java.util.Scanner;

public class 小米_英语考试 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String s = scan.nextLine();
        String t = scan.nextLine();
        if(s == null) {
            System.out.println(t.length());
            System.exit(0);
        }
        if(t == null) {
            System.out.println(s.length());
            System.exit(0);
        }
        int len1 = s.length();
        int len2 = t.length();
        int[][] minDis = new int[len1+1][len2+1];
        for (int i = 0; i <= len1; i++) {
            minDis[i][0] = i;
        }
        for (int i = 0; i <= len2; i++) {
            minDis[0][i] = i;
        }
        for (int i = 1; i <= len1; i++) {
            for (int j = 1; j <= len2; j++) {
                minDis[i][j] = 1 + Math.min(minDis[i-1][j], minDis[i][j-1]);

                if(s.charAt(i-1) == t.charAt(j-1)) {
                    minDis[i][j] = Math.min(minDis[i][j], minDis[i-1][j-1]);
                } else {
                    minDis[i][j] = Math.min(minDis[i][j], minDis[i-1][j-1]+1);
                }
            }
        }
        System.out.println(minDis[len1][len2]);

    }
}
